home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / adanci1a / form1.frm < prev    next >
Text File  |  1999-10-20  |  4KB  |  109 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    BackColor       =   &H00000000&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Flame Works"
  6.    ClientHeight    =   3195
  7.    ClientLeft      =   5595
  8.    ClientTop       =   3135
  9.    ClientWidth     =   5565
  10.    ClipControls    =   0   'False
  11.    Icon            =   "FORM1.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    ScaleHeight     =   3195
  15.    ScaleWidth      =   5565
  16.    Begin VB.VScrollBar VScroll1 
  17.       Height          =   3015
  18.       Left            =   4680
  19.       Max             =   80
  20.       TabIndex        =   2
  21.       Top             =   120
  22.       Width           =   255
  23.    End
  24.    Begin VB.Timer Timer1 
  25.       Interval        =   30
  26.       Left            =   1920
  27.       Top             =   960
  28.    End
  29.    Begin VB.PictureBox Main 
  30.       BackColor       =   &H80000007&
  31.       Height          =   3015
  32.       Left            =   120
  33.       ScaleHeight     =   3000
  34.       ScaleMode       =   0  'User
  35.       ScaleWidth      =   4400
  36.       TabIndex        =   0
  37.       Top             =   120
  38.       Width           =   4455
  39.    End
  40.    Begin VB.PictureBox Original 
  41.       BackColor       =   &H80000007&
  42.       Height          =   3015
  43.       Left            =   120
  44.       Picture         =   "FORM1.frx":12FA
  45.       ScaleHeight     =   3000
  46.       ScaleMode       =   0  'User
  47.       ScaleWidth      =   4400
  48.       TabIndex        =   1
  49.       Top             =   120
  50.       Width           =   4455
  51.    End
  52.    Begin VB.Label Label1 
  53.       BackColor       =   &H80000007&
  54.       BackStyle       =   0  'Transparent
  55.       Caption         =   "Height"
  56.       ForeColor       =   &H8000000E&
  57.       Height          =   255
  58.       Left            =   5040
  59.       TabIndex        =   3
  60.       Top             =   120
  61.       Width           =   615
  62.    End
  63. End
  64. Attribute VB_Name = "Form1"
  65. Attribute VB_GlobalNameSpace = False
  66. Attribute VB_Creatable = False
  67. Attribute VB_PredeclaredId = True
  68. Attribute VB_Exposed = False
  69. Dim P As Integer
  70. Dim HeightValue As Integer          'It's the height of the Flame.
  71. Private Sub Form_Load()
  72. Randomize Timer
  73. P = 1
  74. End Sub
  75. Private Sub Timer1_Timer()
  76. g = 20                              'It's the resolution. If it's too small, the program won't run.
  77.                                     'The smaller it is, the slower the program work.
  78.                                     
  79.                                     'If you change the speed of the program, change the variable G or the inteval of Timer1.
  80.                                     
  81. PlusMinus = 0.3                     'It decides how intense the flame dances.
  82.                                     'The bigger it is, the intenser the flame dances.
  83.                                     'Probably 0.3 is the best value. Test many values.
  84.                                    
  85. For I = 0 To Main.ScaleWidth Step g
  86.  
  87. 10 R = Rnd * PlusMinus * 2 + 1 - PlusMinus  'It decides the degree the flame transforms. It's a random value.
  88. If Abs(P - R) > PlusMinus Then GoTo 10 'If the degree varys too much, Make a new random value.
  89.  
  90. H = HeightValue                     'I use "H" because "HeightValue" is too long
  91.  
  92. Main.PaintPicture Original.Picture, I, H + Main.ScaleHeight * (1 - R) / 3000 * (3000 - H), g + 10, 3000 - (H + Main.ScaleHeight * (1 - R) / 3000 * (3000 - H)), I, 0, g + 1, Original.ScaleHeight, vbSrcCopy
  93. 'PaintPicture. If you move the Main picturebox, you can see "Original" picturebox.
  94.  
  95. If 1 > R Then Main.Line (I, 0)-(I + g + 10, 1500 + Main.ScaleHeight * (1 - R) / 2), 0, BF
  96. 'Fill the empty area with black
  97. P = R
  98. 'It saves the degree and next time it will compare P with the new random number.
  99. Next I
  100. End Sub
  101. Private Sub VScroll1_Change()
  102. HeightValue = VScroll1.Value * 25
  103. 'Update HeightValue as the scroll is changed.
  104. End Sub
  105. Private Sub VScroll1_Scroll()
  106. HeightValue = VScroll1.Value * 25
  107. 'Update HeightValue as the scroll is scrolled.
  108. End Sub
  109.